package com.keyao.subject.common.enums;

import lombok.Getter;

@Getter
public enum ResultCodeEnum {

    SUCCESS(200, "成功"),
    FAIL(500, "失败");

    private Integer code;

    private String desc;

    ResultCodeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static ResultCodeEnum getByCode(Integer codeVal) {
        for (ResultCodeEnum item : ResultCodeEnum.values()) {
            if (item.code == codeVal) {
                return item;
            }
        }
        return null;
    }
}
